<?php

Yii::import('application.models._base.BaseFirmTmpls');

class FirmTmpls extends BaseFirmTmpls {
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
    
	public function beforeSave() {
	    if ($this->isNewRecord) {
            if ($this->hasAttribute('crdate')) {
                $this->crdate = time();
            }
		}	 
	    return parent::beforeSave();
	}	    

    public function scopes() {
        return array(
            'visible'=>array(
                'condition'=>'hidden=0',
            ),
			'hidden' =>array(
                'condition'=>'hidden=1',
			),
            'by_id_desc'=>array(
                'order'=>'id DESC',
            ),
            'by_id_asc'=>array(
                'order'=>'id ASC',
            ),
		);
    }     
}